home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 January: Mac OS SDK / Dev.CD Jan 99 SDK1.toast / Development Kits / Interfaces&Libraries / Universal / Interfaces / PInterfaces / Fonts.p < prev    next >
Encoding:
Text File  |  1998-08-17  |  11.0 KB  |  373 lines  |  [TEXT/MPS ]

  1. {
  2.      File:        Fonts.p
  3.  
  4.      Contains:    Font Manager Interfaces.
  5.  
  6.      Version:    Technology:    MacOS 8
  7.                  Release:    Universal Interfaces 3.2
  8.  
  9.      Copyright:    © 1985-1998 by Apple Computer, Inc., all rights reserved
  10.  
  11.      Bugs?:        For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. }
  17. {$IFC UNDEFINED UsingIncludes}
  18. {$SETC UsingIncludes := 0}
  19. {$ENDC}
  20.  
  21. {$IFC NOT UsingIncludes}
  22.  UNIT Fonts;
  23.  INTERFACE
  24. {$ENDC}
  25.  
  26. {$IFC UNDEFINED __FONTS__}
  27. {$SETC __FONTS__ := 1}
  28.  
  29. {$I+}
  30. {$SETC FontsIncludes := UsingIncludes}
  31. {$SETC UsingIncludes := 1}
  32.  
  33. {$IFC UNDEFINED __MACTYPES__}
  34. {$I MacTypes.p}
  35. {$ENDC}
  36. {$IFC UNDEFINED __QUICKDRAW__}
  37. {$I Quickdraw.p}
  38. {$ENDC}
  39.  
  40.  
  41. {$PUSH}
  42. {$ALIGN MAC68K}
  43. {$LibExport+}
  44.  
  45.  
  46. CONST
  47.     systemFont                    = 0;
  48.     applFont                    = 1;
  49.  
  50. {  kPlatformDefaultGuiFontID is used in QuickTime 3.0  }
  51. {$IFC TARGET_OS_MAC }
  52.     kPlatformDefaultGuiFontID    = 1;
  53.  
  54. {$ELSEC}
  55.     kPlatformDefaultGuiFontID    = -1;
  56.  
  57. {$ENDC}  {TARGET_OS_MAC}
  58.  
  59. {
  60.     The following font constants are deprecated.  
  61.     Please use GetFNum() to look up the font ID by name.
  62. }
  63.     kFontIDNewYork                = 2;
  64.     kFontIDGeneva                = 3;
  65.     kFontIDMonaco                = 4;
  66.     kFontIDVenice                = 5;
  67.     kFontIDLondon                = 6;
  68.     kFontIDAthens                = 7;
  69.     kFontIDSanFrancisco            = 8;
  70.     kFontIDToronto                = 9;
  71.     kFontIDCairo                = 11;
  72.     kFontIDLosAngeles            = 12;
  73.     kFontIDTimes                = 20;
  74.     kFontIDHelvetica            = 21;
  75.     kFontIDCourier                = 22;
  76.     kFontIDSymbol                = 23;
  77.     kFontIDMobile                = 24;
  78.  
  79. {$IFC OLDROUTINENAMES }
  80.     newYork                        = 2;
  81.     geneva                        = 3;
  82.     monaco                        = 4;
  83.     venice                        = 5;
  84.     london                        = 6;
  85.     athens                        = 7;
  86.     sanFran                        = 8;
  87.     toronto                        = 9;
  88.     cairo                        = 11;
  89.     losAngeles                    = 12;
  90.     times                        = 20;
  91.     helvetica                    = 21;
  92.     courier                        = 22;
  93.     symbol                        = 23;
  94.     mobile                        = 24;
  95.  
  96. {$ENDC}  {OLDROUTINENAMES}
  97.  
  98.     commandMark                    = 17;
  99.     checkMark                    = 18;
  100.     diamondMark                    = 19;
  101.     appleMark                    = 20;
  102.  
  103.     propFont                    = 36864;
  104.     prpFntH                        = 36865;
  105.     prpFntW                        = 36866;
  106.     prpFntHW                    = 36867;
  107.     fixedFont                    = 45056;
  108.     fxdFntH                        = 45057;
  109.     fxdFntW                        = 45058;
  110.     fxdFntHW                    = 45059;
  111.     fontWid                        = 44208;
  112.  
  113.  
  114. TYPE
  115.     FMInputPtr = ^FMInput;
  116.     FMInput = PACKED RECORD
  117.         family:                    INTEGER;
  118.         size:                    INTEGER;
  119.         face:                    Style;
  120.         needBits:                BOOLEAN;
  121.         device:                    INTEGER;
  122.         numer:                    Point;
  123.         denom:                    Point;
  124.     END;
  125.  
  126.     FMOutputPtr = ^FMOutput;
  127.     FMOutput = PACKED RECORD
  128.         errNum:                    INTEGER;
  129.         fontHandle:                Handle;                                    {  the previous "privateFontResult" was a mistake!  }
  130.         boldPixels:                UInt8;
  131.         italicPixels:            UInt8;
  132.         ulOffset:                UInt8;
  133.         ulShadow:                UInt8;
  134.         ulThick:                UInt8;
  135.         shadowPixels:            UInt8;
  136.         extra:                    SInt8;
  137.         ascent:                    UInt8;
  138.         descent:                UInt8;
  139.         widMax:                    UInt8;
  140.         leading:                SInt8;
  141.         curStyle:                SInt8;
  142.         numer:                    Point;
  143.         denom:                    Point;
  144.     END;
  145.  
  146.     FMOutPtr                            = ^FMOutput;
  147.     FontRecPtr = ^FontRec;
  148.     FontRec = RECORD
  149.         fontType:                INTEGER;                                { font type }
  150.         firstChar:                INTEGER;                                { ASCII code of first character }
  151.         lastChar:                INTEGER;                                { ASCII code of last character }
  152.         widMax:                    INTEGER;                                { maximum character width }
  153.         kernMax:                INTEGER;                                { negative of maximum character kern }
  154.         nDescent:                INTEGER;                                { negative of descent }
  155.         fRectWidth:                INTEGER;                                { width of font rectangle }
  156.         fRectHeight:            INTEGER;                                { height of font rectangle }
  157.         owTLoc:                    UInt16;                                    { offset to offset/width table }
  158.         ascent:                    INTEGER;                                { ascent }
  159.         descent:                INTEGER;                                { descent }
  160.         leading:                INTEGER;                                { leading }
  161.         rowWords:                INTEGER;                                { row width of bit image / 2  }
  162.     END;
  163.  
  164.     FontRecHdl                            = ^FontRecPtr;
  165.     FMetricRecPtr = ^FMetricRec;
  166.     FMetricRec = RECORD
  167.         ascent:                    Fixed;                                    { base line to top }
  168.         descent:                Fixed;                                    { base line to bottom }
  169.         leading:                Fixed;                                    { leading between lines }
  170.         widMax:                    Fixed;                                    { maximum character width }
  171.         wTabHandle:                Handle;                                    { handle to font width table }
  172.     END;
  173.  
  174. {
  175.    typedef struct FMetricRec FMetricRec, *FMetricRecPtr;
  176.    typedef FMetricRecPtr *FMetricRecHandle;
  177. }
  178.     FMetricRecHandle                    = ^FMetricRecPtr;
  179.     WidEntryPtr = ^WidEntry;
  180.     WidEntry = RECORD
  181.         widStyle:                INTEGER;                                { style entry applies to }
  182.     END;
  183.  
  184.     WidTablePtr = ^WidTable;
  185.     WidTable = RECORD
  186.         numWidths:                INTEGER;                                { number of entries - 1 }
  187.     END;
  188.  
  189.     AsscEntryPtr = ^AsscEntry;
  190.     AsscEntry = RECORD
  191.         fontSize:                INTEGER;
  192.         fontStyle:                INTEGER;
  193.         fontID:                    INTEGER;                                { font resource ID }
  194.     END;
  195.  
  196.     FontAssocPtr = ^FontAssoc;
  197.     FontAssoc = RECORD
  198.         numAssoc:                INTEGER;                                { number of entries - 1 }
  199.     END;
  200.  
  201.     StyleTablePtr = ^StyleTable;
  202.     StyleTable = RECORD
  203.         fontClass:                INTEGER;
  204.         offset:                    LONGINT;
  205.         reserved:                LONGINT;
  206.         indexes:                PACKED ARRAY [0..47] OF CHAR;
  207.     END;
  208.  
  209.     NameTablePtr = ^NameTable;
  210.     NameTable = RECORD
  211.         stringCount:            INTEGER;
  212.         baseFontName:            Str255;
  213.     END;
  214.  
  215.     KernPairPtr = ^KernPair;
  216.     KernPair = RECORD
  217.         kernFirst:                SInt8;                                    { 1st character of kerned pair }
  218.         kernSecond:                SInt8;                                    { 2nd character of kerned pair }
  219.         kernWidth:                INTEGER;                                { kerning in 1pt fixed format }
  220.     END;
  221.  
  222.     KernEntryPtr = ^KernEntry;
  223.     KernEntry = RECORD
  224.         kernStyle:                INTEGER;                                { style the entry applies to }
  225.         kernLength:                INTEGER;                                { length of this entry }
  226.     END;
  227.  
  228.     KernTablePtr = ^KernTable;
  229.     KernTable = RECORD
  230.         numKerns:                INTEGER;                                { number of kerning entries }
  231.     END;
  232.  
  233.     WidthTablePtr = ^WidthTable;
  234.     WidthTable = PACKED RECORD
  235.         tabData:                ARRAY [0..255] OF Fixed;                { character widths }
  236.         tabFont:                Handle;                                    { font record used to build table - the previous FontResult was a mistake! }
  237.         sExtra:                    LONGINT;                                { space extra used for table }
  238.         style:                    LONGINT;                                { extra due to style }
  239.         fID:                    INTEGER;                                { font family ID }
  240.         fSize:                    INTEGER;                                { font size request }
  241.         face:                    INTEGER;                                { style (face) request }
  242.         device:                    INTEGER;                                { device requested }
  243.         inNumer:                Point;                                    { scale factors requested }
  244.         inDenom:                Point;                                    { scale factors requested }
  245.         aFID:                    INTEGER;                                { actual font family ID for table }
  246.         fHand:                    Handle;                                    { family record used to build up table }
  247.         usedFam:                BOOLEAN;                                { used fixed point family widths }
  248.         aFace:                    UInt8;                                    { actual face produced }
  249.         vOutput:                INTEGER;                                { vertical scale output value }
  250.         hOutput:                INTEGER;                                { horizontal scale output value }
  251.         vFactor:                INTEGER;                                { vertical scale output value }
  252.         hFactor:                INTEGER;                                { horizontal scale output value }
  253.         aSize:                    INTEGER;                                { actual size of actual font used }
  254.         tabSize:                INTEGER;                                { total size of table }
  255.     END;
  256.  
  257.     WidthTableHdl                        = ^WidthTablePtr;
  258.  
  259.     FamRecPtr = ^FamRec;
  260.     FamRec = RECORD
  261.         ffFlags:                INTEGER;                                { flags for family }
  262.         ffFamID:                INTEGER;                                { family ID number }
  263.         ffFirstChar:            INTEGER;                                { ASCII code of 1st character }
  264.         ffLastChar:                INTEGER;                                { ASCII code of last character }
  265.         ffAscent:                INTEGER;                                { maximum ascent for 1pt font }
  266.         ffDescent:                INTEGER;                                { maximum descent for 1pt font }
  267.         ffLeading:                INTEGER;                                { maximum leading for 1pt font }
  268.         ffWidMax:                INTEGER;                                { maximum widMax for 1pt font }
  269.         ffWTabOff:                LONGINT;                                { offset to width table }
  270.         ffKernOff:                LONGINT;                                { offset to kerning table }
  271.         ffStylOff:                LONGINT;                                { offset to style mapping table }
  272.         ffProperty:                ARRAY [0..8] OF INTEGER;                { style property info }
  273.         ffIntl:                    ARRAY [0..1] OF INTEGER;                { for international use }
  274.         ffVersion:                INTEGER;                                { version number }
  275.     END;
  276.  
  277.     FontPointSize                        = SInt16;
  278.     FontFamilyID                        = SInt16;
  279. PROCEDURE InitFonts;
  280.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  281.     INLINE $A8FE;
  282.     {$ENDC}
  283. PROCEDURE GetFontName(familyID: INTEGER; VAR name: Str255);
  284.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  285.     INLINE $A8FF;
  286.     {$ENDC}
  287. PROCEDURE GetFNum(name: Str255; VAR familyID: INTEGER);
  288.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  289.     INLINE $A900;
  290.     {$ENDC}
  291. FUNCTION RealFont(fontNum: INTEGER; size: INTEGER): BOOLEAN;
  292.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  293.     INLINE $A902;
  294.     {$ENDC}
  295. PROCEDURE SetFontLock(lockFlag: BOOLEAN);
  296.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  297.     INLINE $A903;
  298.     {$ENDC}
  299. FUNCTION FMSwapFont({CONST}VAR inRec: FMInput): FMOutPtr;
  300.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  301.     INLINE $A901;
  302.     {$ENDC}
  303. PROCEDURE SetFScaleDisable(fscaleDisable: BOOLEAN);
  304.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  305.     INLINE $A834;
  306.     {$ENDC}
  307. PROCEDURE FontMetrics(theMetrics: FMetricRecPtr);
  308.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  309.     INLINE $A835;
  310.     {$ENDC}
  311. PROCEDURE SetFractEnable(fractEnable: BOOLEAN);
  312.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  313.     INLINE $A814;
  314.     {$ENDC}
  315. FUNCTION GetDefFontSize: INTEGER;
  316.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  317.     INLINE $3EB8, $0BA8, $6604, $3EBC, $000C;
  318.     {$ENDC}
  319. FUNCTION IsOutline(numer: Point; denom: Point): BOOLEAN;
  320.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  321.     INLINE $7000, $A854;
  322.     {$ENDC}
  323. PROCEDURE SetOutlinePreferred(outlinePreferred: BOOLEAN);
  324.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  325.     INLINE $7001, $A854;
  326.     {$ENDC}
  327. FUNCTION GetOutlinePreferred: BOOLEAN;
  328.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  329.     INLINE $7009, $A854;
  330.     {$ENDC}
  331. FUNCTION OutlineMetrics(byteCount: INTEGER; textPtr: UNIV Ptr; numer: Point; denom: Point; VAR yMax: INTEGER; VAR yMin: INTEGER; awArray: FixedPtr; lsbArray: FixedPtr; boundsArray: RectPtr): OSErr;
  332.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  333.     INLINE $7008, $A854;
  334.     {$ENDC}
  335. PROCEDURE SetPreserveGlyph(preserveGlyph: BOOLEAN);
  336.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  337.     INLINE $700A, $A854;
  338.     {$ENDC}
  339. FUNCTION GetPreserveGlyph: BOOLEAN;
  340.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  341.     INLINE $700B, $A854;
  342.     {$ENDC}
  343. FUNCTION FlushFonts: OSErr;
  344.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  345.     INLINE $700C, $A854;
  346.     {$ENDC}
  347. FUNCTION GetSysFont: INTEGER;
  348.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  349.     INLINE $3EB8, $0BA6;
  350.     {$ENDC}
  351. FUNCTION GetAppFont: INTEGER;
  352.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  353.     INLINE $3EB8, $0984;
  354.     {$ENDC}
  355. {---------------------------------------------------------------------------------}
  356. FUNCTION SetAntiAliasedTextEnabled(inEnable: BOOLEAN; inMinFontSize: SInt16): OSStatus;
  357. FUNCTION IsAntiAliasedTextEnabled(VAR outMinFontSize: SInt16): BOOLEAN;
  358. {---------------------------------------------------------------------------------}
  359. PROCEDURE QDTextBounds(byteCount: INTEGER; textAddr: UNIV Ptr; VAR bounds: Rect);
  360. FUNCTION FetchFontInfo(fontID: SInt16; fontSize: SInt16; fontStyle: SInt16; VAR info: FontInfo): OSErr;
  361. {---------------------------------------------------------------------------------}
  362.  
  363. {$ALIGN RESET}
  364. {$POP}
  365.  
  366. {$SETC UsingIncludes := FontsIncludes}
  367.  
  368. {$ENDC} {__FONTS__}
  369.  
  370. {$IFC NOT UsingIncludes}
  371.  END.
  372. {$ENDC}
  373.